﻿$(function () {
    $(".loc").click(function () {
        var url = $(this).attr("href");
        location.href = url;
    });
});

var map = null;
function initialize() {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GScaleControl());
        //map.addControl(new GOverviewMapControl());

        if (address.length == 1) {
            var arr = address[0].split("$");
            var point = new GLatLng(parseFloat(arr[1]), parseFloat(arr[2]));
            var marker = new GMarker(point);
            map.setCenter(point, 14, G_NORMAL_MAP);
            map.addOverlay(marker);
            marker.openInfoWindowHtml(arr[3]);
        }
        else {
            map.setCenter(new GLatLng(39.008009, -77.380108), 9, G_NORMAL_MAP);
            for (var i = 0; i < address.length; i++) {
                if (address[i] != "") {
                    var arr = address[i].split("$");

                    if (arr[1] != "" && arr[2] != "") {
                        var point = new GLatLng(parseFloat(arr[1]), parseFloat(arr[2]));
                        var marker = new GMarker(point);
                        map.addOverlay(marker);
                        if (arr[0] == "1") {
                            marker.bindInfoWindowHtml(arr[3]);
                            marker.openInfoWindowHtml(arr[3]);
                        }
                        else {
                            marker.bindInfoWindowHtml(arr[3]);
                        }
                    }
                }
            }
        }
    }
}

window.onload = setTimeout('initialize()', 500);
window.onunload = GUnload();